package com.sg.service.biz.framework.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.RedisUtil;
import com.sg.dto.base.framework.req.*;
import com.sg.dto.biz.framework.req.*;
import com.sg.dto.biz.framework.res.*;
import com.sg.entity.BizAppScene;
import com.sg.entity.BizAppSceneRelationship;
import com.sg.entity.BizScene;
import com.sg.service.base.framework.MBizAppSceneRelationshipService;
import com.sg.service.base.framework.MBizAppSceneService;
import com.sg.service.base.framework.MBizSceneService;
import com.sg.common.exception.Assert;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class AppSceneServiceImpl
        implements com.wicket.okrframework.biz.service.AppSceneService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MBizSceneService mBizSceneService;
    @Resource
    private MBizAppSceneRelationshipService mBizAppSceneRelationshipService;
    @Resource
    private NbAppScene nbAppScene;
    @Resource
    private MBizAppSceneService mBizAppSceneService;

    /**
     * D1-1查询未赋能业务场景列表[2175]
     * gen by moon at 8/10/2022, 3:21:06 AM
     */
    @Trace(operationName = "D1-1查询未赋能业务场景列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryNotEnabledBizSceneListRespDto queryNotEnabledBizSceneList(QueryNotEnabledBizSceneListReqDto reqDto) {


        QuerySceneCollectionRemoveExistingDataListRespDto collectionRemoveExistingDataRes_1 = null;
//步骤0: 1-1-09查询业务场景列表 - queryBizSceneList
        List<BizScene> listBizScene = new ArrayList<>();
        QueryBizSceneListReq queryBizSceneListReq = new QueryBizSceneListReq();
        queryBizSceneListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:63347_1
        if (reqDto != null) {
            queryBizSceneListReq.setBizAppId(reqDto.getBizAppId());//sourceId:63345_1
        }

        /*1-1-09查询业务场景列表[1416]   */
        Assert.isNull(queryBizSceneListReq.getBizAppId(), "D1-1查询未赋能业务场景列表-1-1-09查询业务场景列表-业务应用ID不能为空", false);
        Assert.isNull(queryBizSceneListReq.getSubjectLifeCycle(), "D1-1查询未赋能业务场景列表-1-1-09查询业务场景列表-主体生命周期不能为空", false);
        listBizScene = mBizSceneService.queryBizSceneList(queryBizSceneListReq);


//步骤1: 1-1-08查询应用赋能场景列表 - queryBizAppSceneRelList
        List<BizAppSceneRelationship> listBizAppSceneRelationship = new ArrayList<>();
        QueryBizAppSceneRelListReq queryBizAppSceneRelListReq = new QueryBizAppSceneRelListReq();
        queryBizAppSceneRelListReq.setIsArchive("FALSE");//sourceId:63354_1
        if (reqDto != null) {
            queryBizAppSceneRelListReq.setBizAppId(reqDto.getBizAppId());//sourceId:63352_1
        }

        /*1-1-08查询应用赋能场景列表[1418]   */
        Assert.isNull(queryBizAppSceneRelListReq.getBizAppId(), "D1-1查询未赋能业务场景列表-1-1-08查询应用赋能场景列表-赋能业务应用ID不能为空", false);
        Assert.isNull(queryBizAppSceneRelListReq.getIsArchive(), "D1-1查询未赋能业务场景列表-1-1-08查询应用赋能场景列表-是否存档不能为空", false);
        listBizAppSceneRelationship = mBizAppSceneRelationshipService.queryBizAppSceneRelList(queryBizAppSceneRelListReq);


//步骤2: M-查询可赋能业务应用场景列表（特殊方法） - querySceneCollectionRemoveExistingDataList
        //ModelCode: collectionRemoveExistingData
        QuerySceneCollectionRemoveExistingDataListRespDto collectionRemoveExistingDataRes = null;
        if (listBizScene != null && listBizScene.size() > 0) {
            QuerySceneCollectionRemoveExistingDataListReqDto collectionRemoveExistingDataReq = new QuerySceneCollectionRemoveExistingDataListReqDto();
            collectionRemoveExistingDataReq.setBizSceneList(listBizScene.stream().map(item -> BeanUtil.toBean(item, BizSceneDto.class)).collect(Collectors.toList()));//sourceId:63357_1
            collectionRemoveExistingDataReq.setBizAppSceneRelList(listBizAppSceneRelationship.stream().map(item -> BeanUtil.toBean(item, BizAppSceneRelDto.class)).collect(Collectors.toList()));//sourceId:63358_1

            /*M-查询可赋能业务应用场景列表（特殊方法）[1606]  入参两个数据集，通过已存在标识字段匹配，去除第一个数据集中已存在的第二个数据集的数据 */

            collectionRemoveExistingDataRes = nbAppScene.querySceneCollectionRemoveExistingDataList(collectionRemoveExistingDataReq);

            collectionRemoveExistingDataRes_1 = collectionRemoveExistingDataRes;
        }

        QueryNotEnabledBizSceneListRespDto retData = new QueryNotEnabledBizSceneListRespDto();
        if (collectionRemoveExistingDataRes_1 != null) {
            retData.setBizSceneList(collectionRemoveExistingDataRes_1.getBizSceneList());//sourceId:63362_1
        }


        return retData;
    }

    /**
     * D1-1修改业务应用[746]
     * gen by moon at 8/10/2022, 3:26:01 AM
     */
    @Trace(operationName = "D1-1修改业务应用")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdateBizAppSceneRespDto updateBizAppScene(UpdateBizAppSceneReqDto reqDto) {


        //步骤0: 1-1-07修改业务应用	 - updateBizAppScene
        boolean bOOLEAN;
        BizAppScene bizAppScene = new BizAppScene();
        if (reqDto != null) {
            bizAppScene.setBizAppId(reqDto.getBizAppId());//sourceId:20955_1
            bizAppScene.setBizAppCode(reqDto.getBizAppCode());//sourceId:25387_1
            bizAppScene.setBizAppName(reqDto.getBizAppName());//sourceId:20958_1
            bizAppScene.setBizAppDes(reqDto.getBizAppDes());//sourceId:20959_1
            bizAppScene.setMiddleground(reqDto.getMiddleground());//sourceId:20960_1
            bizAppScene.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:20961_1
        }

        /*1-1-07修改业务应用	[30]   */
        Assert.isNull(bizAppScene.getBizAppId(), "D1-1修改业务应用-1-1-07修改业务应用	-业务应用ID不能为空", false);
        bOOLEAN = mBizAppSceneService.updateBizAppScene(bizAppScene);


        UpdateBizAppSceneRespDto retData = new UpdateBizAppSceneRespDto();


        return retData;
    }

    /**
     * D1-1查询业务应用菜单列表（边界）[1441]
     * gen by moon at 10/2/2022, 12:04:44 AM
     */
    @Trace(operationName = "D1-1查询业务应用菜单列表（边界）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizAppSceneMenuListRespDto queryBizAppSceneMenuList(QueryBizAppSceneMenuListReqDto reqDto) {


        List<BizAppScene> listBizAppScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用列表 - queryBizAppSceneList
        List<BizAppScene> listBizAppScene = new ArrayList<>();
        QueryBizAppSceneListReq queryBizAppSceneListReq = new QueryBizAppSceneListReq();
        queryBizAppSceneListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:34338_1

        /*1-1-07查询业务应用列表[223]   */
        Assert.isNull(queryBizAppSceneListReq.getSubjectLifeCycle(), "D1-1查询业务应用菜单列表（边界）-1-1-07查询业务应用列表-主体生命周期不能为空", false);
        listBizAppScene = mBizAppSceneService.queryBizAppSceneList(queryBizAppSceneListReq);

        listBizAppScene_1 = listBizAppScene;

        QueryBizAppSceneMenuListRespDto retData = new QueryBizAppSceneMenuListRespDto();
        retData.setBizAppSceneList(listBizAppScene_1.stream().map(item -> BeanUtil.toBean(item, BizAppSceneDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:34353_1


        return retData;
    }

    /**
     * D1-1查询应用赋能场景列表[1417]
     * gen by moon at 10/28/2022, 12:25:15 AM
     */
    @Trace(operationName = "D1-1查询应用赋能场景列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizAppSceneRelListRespDto queryBizAppSceneRelList(QueryBizAppSceneRelListReqDto reqDto) {


        List<BizAppSceneRelationship> listBizAppSceneRelationship_1 = new ArrayList<>();
        List<BizScene> listBizScene_1 = new ArrayList<>();
        List<BizAppScene> listBizAppScene_1 = new ArrayList<>();
        List<BizAppScene> listBizAppScene_3 = new ArrayList<>();
//virtualUsage 1-1-08查询应用赋能场景列表  20401
        List<BizAppSceneRelationship> listBizAppSceneRelationship = new ArrayList<>();
        QueryBizAppSceneRelListReq queryBizAppSceneRelListReq = new QueryBizAppSceneRelListReq();
        if (reqDto != null) {
            queryBizAppSceneRelListReq.setBizAppId(reqDto.getBizAppId());//SimpleFieldAssign//sourceId:33255_1_20401
            queryBizAppSceneRelListReq.setByBizAppId(reqDto.getByBizAppId());//SimpleFieldAssign//sourceId:35224_1_20401
            queryBizAppSceneRelListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:33257_1_20401
        }

        /*1-1-08查询应用赋能场景列表[1418]   */
        Assert.isNull(queryBizAppSceneRelListReq.getIsArchive(), "D1-1查询应用赋能场景列表-1-1-08查询应用赋能场景列表-是否存档不能为空", false);
        listBizAppSceneRelationship = mBizAppSceneRelationshipService.queryBizAppSceneRelList(queryBizAppSceneRelListReq);


        listBizAppSceneRelationship_1 = listBizAppSceneRelationship;
//virtualUsage 1-1-09批量查询业务场景列表  20402
        List<BizScene> listBizScene = new ArrayList<>();
        if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0 && listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
            BatchQueryBizSceneReq batchQueryBizSceneReq = new BatchQueryBizSceneReq();
            batchQueryBizSceneReq.setBizSceneList(listBizAppSceneRelationship.stream().map(item -> item.getBizSceneId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:34858_1_20402

            /*1-1-09批量查询业务场景列表[225]   */

            listBizScene = mBizSceneService.batchQueryBizScene(batchQueryBizSceneReq);


            listBizScene_1 = listBizScene;
        }
        if ((reqDto != null && reqDto.getBizAppId() != null && reqDto != null && reqDto.getByBizAppId() == null)) {
            //if((D1-1查询应用赋能场景列表.赋能业务应用ID 值不等于空  and D1-1查询应用赋能场景列表.被赋能业务应用ID 值等于空 ))  20403

            List<BizAppScene> listBizAppScene = new ArrayList<>();
            if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0 && listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
                BatchQueryBizAppSceneReq batchQueryBizAppSceneReq = new BatchQueryBizAppSceneReq();
                batchQueryBizAppSceneReq.setBizAppSceneList(listBizAppSceneRelationship.stream().map(item -> item.getByBizAppId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:35219_1_20405

                /*1-1-07批量查询业务应用列表（被赋能业务应用）[1216]   */

                listBizAppScene = mBizAppSceneService.batchQueryBizAppScene(batchQueryBizAppSceneReq);


                listBizAppScene_1 = listBizAppScene;
            }
        } else if ((reqDto != null && reqDto.getByBizAppId() != null && reqDto != null && reqDto.getBizAppId() == null)) {
            //elseif((D1-1查询应用赋能场景列表.被赋能业务应用ID 值不等于空  and D1-1查询应用赋能场景列表.赋能业务应用ID 值等于空 ))  20404

            List<BizAppScene> listBizAppScene_2 = new ArrayList<>();
            if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0 && listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
                BatchQueryBizAppSceneReq batchQueryBizAppSceneReq_1 = new BatchQueryBizAppSceneReq();
                batchQueryBizAppSceneReq_1.setBizAppSceneList(listBizAppSceneRelationship.stream().map(item -> item.getBizAppId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:406146_1_20439

                /*1-1-07批量查询业务应用列表（赋能业务应用）[1216]   */

                listBizAppScene_2 = mBizAppSceneService.batchQueryBizAppScene(batchQueryBizAppSceneReq_1);


                listBizAppScene_3 = listBizAppScene_2;
            }
        }
        QueryBizAppSceneRelListRespDto retData = new QueryBizAppSceneRelListRespDto();
        //数据集融合  MoreListToOneSource
        if (listBizAppSceneRelationship_1 != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1) && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1)) {
            for (BizAppSceneRelationship bizAppSceneRelationship : listBizAppSceneRelationship_1) {
                BizAppSceneRelDto retElm = new BizAppSceneRelDto();
                retElm.setBizAppSceneRelationshipId(bizAppSceneRelationship.getBizAppSceneRelationshipId());//SimpleFieldAssign//sourceId:15741_2
                retElm.setByBizAppId(bizAppSceneRelationship.getByBizAppId());//SimpleFieldAssign//sourceId:15871_2
                retElm.setBizSceneId(bizAppSceneRelationship.getBizSceneId());//SimpleFieldAssign//sourceId:15744_2
                retElm.setBizAppId(bizAppSceneRelationship.getBizAppId());//SimpleFieldAssign//sourceId:22479_2
                retElm.setSubjectLifeCycle(bizAppSceneRelationship.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:15784_2
                retElm.setIsArchive(bizAppSceneRelationship.getIsArchive());//SimpleFieldAssign//sourceId:15785_2
                retElm.setOperationInductionId(bizAppSceneRelationship.getOperationInductionId());//SimpleFieldAssign//sourceId:15851_2
                retElm.setOperateTime(bizAppSceneRelationship.getOperateTime());//SimpleFieldAssign//sourceId:15852_2
                retData.getBizAppSceneRelList().add(retElm);
                if (listBizScene_1 != null && !CollectionUtil.isEmpty(listBizScene_1)) {
                    for (BizScene bizScene : listBizScene_1) {
                        if (bizScene.getBizSceneId().equals(bizAppSceneRelationship.getBizSceneId())) {
                            retElm.setBizSceneCode(bizScene.getBizSceneCode());//SimpleFieldAssign//sourceId:15745_2
                            retElm.setBizSceneName(bizScene.getBizSceneName());//SimpleFieldAssign//sourceId:15747_2
                            retElm.setBizSceneDes(bizScene.getBizSceneDes());//SimpleFieldAssign//sourceId:15781_2
                        }
                    }
                }

                if (listBizAppScene_1 != null && !CollectionUtil.isEmpty(listBizAppScene_1)) {
                    for (BizAppScene bizAppScene : listBizAppScene_1) {
                        if (bizAppScene.getBizAppId().equals(bizAppSceneRelationship.getByBizAppId())) {
                            retElm.setBizAppCode(bizAppScene.getBizAppCode());//SimpleFieldAssign//sourceId:15752_2
                            retElm.setBizAppName(bizAppScene.getBizAppName());//SimpleFieldAssign//sourceId:15753_2
                        }
                    }
                }

                if (listBizAppScene_1 != null && !CollectionUtil.isEmpty(listBizAppScene_1)) {
                    for (BizAppScene bizAppScene : listBizAppScene_1) {
                        if (bizAppScene.getBizAppId().equals(bizAppSceneRelationship.getByBizAppId())) {
                            retElm.setBizAppCode(bizAppScene.getBizAppCode());//SimpleFieldAssign//sourceId:15752_2
                            retElm.setBizAppName(bizAppScene.getBizAppName());//SimpleFieldAssign//sourceId:15753_2
                        }
                    }
                }

                if (listBizAppScene_3 != null && !CollectionUtil.isEmpty(listBizAppScene_3)) {
                    for (BizAppScene bizAppScene : listBizAppScene_3) {
                        if (bizAppScene.getBizAppId().equals(bizAppSceneRelationship.getBizAppId())) {
                            retElm.setBizAppCode(bizAppScene.getBizAppCode());//SimpleFieldAssign//sourceId:15752_2
                            retElm.setBizAppName(bizAppScene.getBizAppName());//SimpleFieldAssign//sourceId:15753_2
                        }
                    }
                }

            }
        }//sourceId:34875_1


        return retData;
    }

    /**
     * D1-1批量查业务场景[861]
     * gen by moon at 10/28/2022, 8:45:41 PM
     */
    @Trace(operationName = "D1-1批量查业务场景")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public BatchQueryBizSceneRespDto batchQueryBizScene(BatchQueryBizSceneReqDto reqDto) {


        List<BizScene> listBizScene_1 = new ArrayList<>();
        List<BizAppScene> listBizAppScene_1 = new ArrayList<>();
//步骤0: 1-1-09批量查询业务场景列表 - batchQueryBizScene
        List<BizScene> listBizScene = new ArrayList<>();
        BatchQueryBizSceneReq batchQueryBizSceneReq = new BatchQueryBizSceneReq();
        if (reqDto != null) {
            batchQueryBizSceneReq.setBizSceneList(reqDto.getBizSceneList());//list-field-assign//sourceId:33271_1
        }

        /*1-1-09批量查询业务场景列表[225]   */

        listBizScene = mBizSceneService.batchQueryBizScene(batchQueryBizSceneReq);


        listBizScene_1 = listBizScene;

//步骤1: 1-1-07批量查询业务应用列表 - batchQueryBizAppScene
        List<BizAppScene> listBizAppScene = new ArrayList<>();
        if (listBizScene != null && !CollectionUtil.isEmpty(listBizScene) && listBizScene.size() > 0) {
            BatchQueryBizAppSceneReq batchQueryBizAppSceneReq = new BatchQueryBizAppSceneReq();
            batchQueryBizAppSceneReq.setBizAppSceneList(listBizScene.stream().map(item -> item.getBizAppId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:33277_1

            /*1-1-07批量查询业务应用列表[1216]   */

            listBizAppScene = mBizAppSceneService.batchQueryBizAppScene(batchQueryBizAppSceneReq);


            listBizAppScene_1 = listBizAppScene;
        }

        BatchQueryBizSceneRespDto retData = new BatchQueryBizSceneRespDto();
        //数据集融合  MoreListToOneSource
        if (listBizScene_1 != null && !CollectionUtil.isEmpty(listBizScene_1) && !CollectionUtil.isEmpty(listBizScene_1)) {
            for (BizScene bizScene : listBizScene_1) {
                BizSceneDto retElm = new BizSceneDto();
                retElm.setBizSceneId(bizScene.getBizSceneId());//SimpleFieldAssign//sourceId:14861_2
                retElm.setBizSceneCode(bizScene.getBizSceneCode());//SimpleFieldAssign//sourceId:14862_2
                retElm.setBizAppId(bizScene.getBizAppId());//SimpleFieldAssign//sourceId:14863_2
                retElm.setBizSceneName(bizScene.getBizSceneName());//SimpleFieldAssign//sourceId:14864_2
                retElm.setBizSceneDes(bizScene.getBizSceneDes());//SimpleFieldAssign//sourceId:14865_2
                retElm.setSubjectLifeCycle(bizScene.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:14866_2
                retElm.setIsArchive(bizScene.getIsArchive());//SimpleFieldAssign//sourceId:14867_2
                retData.getBizSceneList().add(retElm);
                if (listBizAppScene_1 != null && !CollectionUtil.isEmpty(listBizAppScene_1)) {
                    for (BizAppScene bizAppScene : listBizAppScene_1) {
                        if (bizAppScene.getBizAppId().equals(bizScene.getBizAppId())) {
                            retElm.setBizAppName(bizAppScene.getBizAppName());//SimpleFieldAssign//sourceId:14936_2
                        }
                    }
                }

            }
        }//sourceId:33272_1


        return retData;
    }

    /**
     * D1-1新增业务应用[744]
     * gen by moon at 8/10/2022, 3:25:56 AM
     */
    @Trace(operationName = "D1-1新增业务应用")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddBizAppSceneRespDto addBizAppScene(AddBizAppSceneReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-1-07新增业务应用 - addBizAppScene
        String string = null;
        BizAppScene bizAppScene = new BizAppScene();
        if (reqDto != null) {
            bizAppScene.setBizAppCode(reqDto.getBizAppCode());//sourceId:20841_1
            bizAppScene.setBizAppName(reqDto.getBizAppName());//sourceId:20843_1
            bizAppScene.setBizAppDes(reqDto.getBizAppDes());//sourceId:20844_1
            bizAppScene.setMiddleground(reqDto.getMiddleground());//sourceId:20845_1
            bizAppScene.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:20846_1
        }

        /*1-1-07新增业务应用[29]   */
        Assert.isNull(bizAppScene.getBizAppCode(), "D1-1新增业务应用-1-1-07新增业务应用-业务应用标识不能为空", false);
        Assert.isNull(bizAppScene.getBizAppName(), "D1-1新增业务应用-1-1-07新增业务应用-业务应用名称不能为空", false);
        Assert.isNull(bizAppScene.getMiddleground(), "D1-1新增业务应用-1-1-07新增业务应用-是否中台不能为空", false);
        Assert.isNull(bizAppScene.getSubjectLifeCycle(), "D1-1新增业务应用-1-1-07新增业务应用-主体生命周期不能为空", false);
        string = mBizAppSceneService.addBizAppScene(bizAppScene);

        string_1 = string;

        AddBizAppSceneRespDto retData = new AddBizAppSceneRespDto();
        if (string_1 != null) {
            retData.setBizAppId(string_1);//sourceId:20853_1
        }


        return retData;
    }

    /**
     * D1-1查询业务应用详情[743]
     * gen by moon at 10/26/2022, 12:20:50 AM
     */
    @Trace(operationName = "D1-1查询业务应用详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizAppSceneDetailRespDto queryBizAppSceneDetail(QueryBizAppSceneDetailReqDto reqDto) {


        BizAppScene bizAppScene_1 = null;
//步骤0: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq = new QueryBizAppSceneDetailReq();
        if (reqDto != null) {
            queryBizAppSceneDetailReq.setBizAppId(reqDto.getBizAppId());//SimpleFieldAssign//sourceId:25318_1
            queryBizAppSceneDetailReq.setBizAppCode(reqDto.getBizAppCode());//SimpleFieldAssign//sourceId:25319_1
        }

        /*1-1-07查询业务应用详情[32]   */

        bizAppScene = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq);


        bizAppScene_1 = bizAppScene;

        QueryBizAppSceneDetailRespDto retData = new QueryBizAppSceneDetailRespDto();
        if (bizAppScene_1 != null) {
            retData.setBizAppId(bizAppScene_1.getBizAppId());//SimpleFieldAssign//sourceId:25334_1
            retData.setBizAppCode(bizAppScene_1.getBizAppCode());//SimpleFieldAssign//sourceId:25335_1
            retData.setBizAppName(bizAppScene_1.getBizAppName());//SimpleFieldAssign//sourceId:25337_1
            retData.setBizAppDes(bizAppScene_1.getBizAppDes());//SimpleFieldAssign//sourceId:25338_1
            retData.setMiddleground(bizAppScene_1.getMiddleground());//SimpleFieldAssign//sourceId:25339_1
            retData.setSubjectLifeCycle(bizAppScene_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:25340_1
            retData.setOperationInductionId(bizAppScene_1.getOperationInductionId());//SimpleFieldAssign//sourceId:25341_1
            retData.setOperateTime(bizAppScene_1.getOperateTime());//SimpleFieldAssign//sourceId:25342_1
        }


        return retData;
    }

    /**
     * D1-1查询业务应用列表[742]
     * gen by moon at 8/10/2022, 3:25:49 AM
     */
    @Trace(operationName = "D1-1查询业务应用列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizAppSceneListRespDto queryBizAppSceneList(QueryBizAppSceneListReqDto reqDto) {


        List<BizAppScene> listBizAppScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用列表 - queryBizAppSceneList
        List<BizAppScene> listBizAppScene = new ArrayList<>();
        QueryBizAppSceneListReq queryBizAppSceneListReq = new QueryBizAppSceneListReq();
        if (reqDto != null) {
            queryBizAppSceneListReq.setIsArchive(reqDto.getIsArchive());//sourceId:23091_1
            queryBizAppSceneListReq.setMiddleground(reqDto.getMiddleground());//sourceId:23090_1
            queryBizAppSceneListReq.setBizAppId(reqDto.getBizAppId());//sourceId:26552_1
            queryBizAppSceneListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:23110_1
        }

        /*1-1-07查询业务应用列表[223]   */

        listBizAppScene = mBizAppSceneService.queryBizAppSceneList(queryBizAppSceneListReq);

        listBizAppScene_1 = listBizAppScene;

        QueryBizAppSceneListRespDto retData = new QueryBizAppSceneListRespDto();
        retData.setBizAppSceneList(listBizAppScene_1.stream().map(item -> BeanUtil.toBean(item, BizAppSceneDto.class)).collect(Collectors.toList()));//sourceId:31387_1


        return retData;
    }

    /**
     * D1-1查询业务场景列表[753]
     * gen by moon at 10/2/2022, 7:47:29 AM
     */
    @Trace(operationName = "D1-1查询业务场景列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizSceneListRespDto queryBizSceneList(QueryBizSceneListReqDto reqDto) {


        List<BizScene> listBizScene_1 = new ArrayList<>();
//步骤0: 1-1-09查询业务场景列表 - queryBizSceneList
        List<BizScene> listBizScene = new ArrayList<>();
        QueryBizSceneListReq queryBizSceneListReq = new QueryBizSceneListReq();
        if (reqDto != null) {
            queryBizSceneListReq.setBizAppId(reqDto.getBizAppId());//SimpleFieldAssign//sourceId:33176_1
            queryBizSceneListReq.setBizSceneName(reqDto.getBizSceneName());//SimpleFieldAssign//sourceId:33177_1
            queryBizSceneListReq.setBizSceneCode(reqDto.getBizSceneCode());//SimpleFieldAssign//sourceId:46620_1
            queryBizSceneListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:33178_1
            queryBizSceneListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:33179_1
        }

        /*1-1-09查询业务场景列表[1416]   */

        listBizScene = mBizSceneService.queryBizSceneList(queryBizSceneListReq);


        listBizScene_1 = listBizScene;

        QueryBizSceneListRespDto retData = new QueryBizSceneListRespDto();
        retData.setBizSceneList(listBizScene_1.stream().map(item -> BeanUtil.toBean(item, BizSceneDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:33180_1


        return retData;
    }

    /**
     * D1-1查询业务场景详情[713]
     * gen by moon at 10/28/2022, 11:02:45 PM
     */
    @Trace(operationName = "D1-1查询业务场景详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizSceneDetailRespDto queryBizSceneDetail(QueryBizSceneDetailReqDto reqDto) {


        BizScene bizScene_1 = null;
//步骤0: 1-1-09查询业务场景详情 - queryBizSceneDetail
        BizScene bizScene = null;
        QueryBizSceneDetailReq queryBizSceneDetailReq = new QueryBizSceneDetailReq();
        if (reqDto != null) {
            queryBizSceneDetailReq.setBizSceneId(reqDto.getBizSceneId());//SimpleFieldAssign//sourceId:34583_1
            queryBizSceneDetailReq.setBizSceneCode(reqDto.getBizSceneCode());//SimpleFieldAssign//sourceId:34584_1
            queryBizSceneDetailReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:34585_1
        }

        /*1-1-09查询业务场景详情[40]   */

        bizScene = mBizSceneService.queryBizSceneDetail(queryBizSceneDetailReq);


        bizScene_1 = bizScene;

        QueryBizSceneDetailRespDto retData = new QueryBizSceneDetailRespDto();
        if (bizScene_1 != null) {
            retData.setBizSceneId(bizScene_1.getBizSceneId());//SimpleFieldAssign//sourceId:34603_1
            retData.setBizSceneCode(bizScene_1.getBizSceneCode());//SimpleFieldAssign//sourceId:34604_1
            retData.setBizSceneName(bizScene_1.getBizSceneName());//SimpleFieldAssign//sourceId:34605_1
            retData.setBizSceneDes(bizScene_1.getBizSceneDes());//SimpleFieldAssign//sourceId:34606_1
            retData.setBizAppId(bizScene_1.getBizAppId());//SimpleFieldAssign//sourceId:34607_1
            retData.setSubjectLifeCycle(bizScene_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:34608_1
            retData.setOperationInductionId(bizScene_1.getOperationInductionId());//SimpleFieldAssign//sourceId:34609_1
            retData.setCreateInductionId(bizScene_1.getCreateInductionId());//SimpleFieldAssign//sourceId:34610_1
            retData.setReleaseInductionId(bizScene_1.getReleaseInductionId());//SimpleFieldAssign//sourceId:34611_1
            retData.setArchiveInductionId(bizScene_1.getArchiveInductionId());//SimpleFieldAssign//sourceId:34612_1
            retData.setOperateTime(bizScene_1.getOperateTime());//SimpleFieldAssign//sourceId:34613_1
            retData.setCreateTime(bizScene_1.getCreateTime());//SimpleFieldAssign//sourceId:34614_1
            retData.setReleaseTime(bizScene_1.getReleaseTime());//SimpleFieldAssign//sourceId:34615_1
            retData.setArchiveTime(bizScene_1.getArchiveTime());//SimpleFieldAssign//sourceId:34616_1
        }


        return retData;
    }

    /**
     * D1-1新增应用赋能场景[764]
     * gen by moon at 8/10/2022, 3:26:21 AM
     */
    @Trace(operationName = "D1-1新增应用赋能场景")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddBizAppSceneRelRespDto addBizAppSceneRel(AddBizAppSceneRelReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-1-08新增应用赋能场景 - addBizAppSceneRel
        String string = null;
        BizAppSceneRelationship bizAppSceneRelationship = new BizAppSceneRelationship();
        if (reqDto != null) {
            bizAppSceneRelationship.setByBizAppId(reqDto.getByBizAppId());//sourceId:35215_1
            bizAppSceneRelationship.setBizSceneId(reqDto.getBizSceneId());//sourceId:34926_1
            bizAppSceneRelationship.setBizAppId(reqDto.getBizAppId());//sourceId:34927_1
            bizAppSceneRelationship.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:34928_1
        }

        /*1-1-08新增应用赋能场景[33]   */
        Assert.isNull(bizAppSceneRelationship.getByBizAppId(), "D1-1新增应用赋能场景-1-1-08新增应用赋能场景-被赋能业务应用ID不能为空", false);
        Assert.isNull(bizAppSceneRelationship.getBizSceneId(), "D1-1新增应用赋能场景-1-1-08新增应用赋能场景-被赋能业务场景ID不能为空", false);
        Assert.isNull(bizAppSceneRelationship.getBizAppId(), "D1-1新增应用赋能场景-1-1-08新增应用赋能场景-赋能业务应用ID不能为空", false);
        Assert.isNull(bizAppSceneRelationship.getSubjectLifeCycle(), "D1-1新增应用赋能场景-1-1-08新增应用赋能场景-主体生命周期不能为空", false);
        string = mBizAppSceneRelationshipService.addBizAppSceneRel(bizAppSceneRelationship);

        string_1 = string;

        AddBizAppSceneRelRespDto retData = new AddBizAppSceneRelRespDto();
        if (string_1 != null) {
            retData.setBizAppSceneRelationshipId(string_1);//sourceId:34929_1
        }


        return retData;
    }

    /**
     * D1-1修改业务场景[756]
     * gen by moon at 8/10/2022, 3:26:16 AM
     */
    @Trace(operationName = "D1-1修改业务场景")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdateBizSceneRespDto updateBizScene(UpdateBizSceneReqDto reqDto) {


        //步骤0: 1-1-09修改业务场景	 - updateBizScene
        boolean bOOLEAN;
        BizScene bizScene = new BizScene();
        if (reqDto != null) {
            bizScene.setBizSceneId(reqDto.getBizSceneId());//sourceId:25876_1
            bizScene.setBizSceneCode(reqDto.getBizSceneCode());//sourceId:25877_1
            bizScene.setBizSceneName(reqDto.getBizSceneName());//sourceId:25878_1
            bizScene.setBizSceneDes(reqDto.getBizSceneDes());//sourceId:25879_1
            bizScene.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:25880_1
        }

        /*1-1-09修改业务场景	[38]   */
        Assert.isNull(bizScene.getBizSceneId(), "D1-1修改业务场景-1-1-09修改业务场景	-业务场景ID不能为空", false);
        bOOLEAN = mBizSceneService.updateBizScene(bizScene);


        UpdateBizSceneRespDto retData = new UpdateBizSceneRespDto();


        return retData;
    }

    /**
     * D1-1新增业务场景[755]
     * gen by moon at 8/10/2022, 3:26:11 AM
     */
    @Trace(operationName = "D1-1新增业务场景")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddBizSceneRespDto addBizScene(AddBizSceneReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-1-09新增业务场景 - addBizScene
        String string = null;
        BizScene bizScene = new BizScene();
        if (reqDto != null) {
            bizScene.setBizSceneCode(reqDto.getBizSceneCode());//sourceId:25770_1
            bizScene.setBizAppId(reqDto.getBizAppId());//sourceId:25771_1
            bizScene.setBizSceneName(reqDto.getBizSceneName());//sourceId:25772_1
            bizScene.setBizSceneDes(reqDto.getBizSceneDes());//sourceId:25773_1
            bizScene.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:25774_1
        }

        /*1-1-09新增业务场景[37]   */
        Assert.isNull(bizScene.getBizSceneCode(), "D1-1新增业务场景-1-1-09新增业务场景-业务场景标识不能为空", false);
        Assert.isNull(bizScene.getBizAppId(), "D1-1新增业务场景-1-1-09新增业务场景-业务应用ID不能为空", false);
        Assert.isNull(bizScene.getBizSceneName(), "D1-1新增业务场景-1-1-09新增业务场景-业务场景名称不能为空", false);
        Assert.isNull(bizScene.getSubjectLifeCycle(), "D1-1新增业务场景-1-1-09新增业务场景-主体生命周期不能为空", false);
        string = mBizSceneService.addBizScene(bizScene);

        string_1 = string;

        AddBizSceneRespDto retData = new AddBizSceneRespDto();
        if (string_1 != null) {
            retData.setBizSceneId(string_1);//sourceId:27635_1
        }


        return retData;
    }

    /**
     * D1-1查询业务场景菜单列表[4579]
     * gen by moon at 9/17/2022, 10:58:52 PM
     */
    @Trace(operationName = "D1-1查询业务场景菜单列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizSceneMenuListRespDto queryBizSceneMenuList(QueryBizSceneMenuListReqDto reqDto) {


        List<BizScene> listBizScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq = new QueryBizAppSceneDetailReq();
        if (reqDto != null) {
            queryBizAppSceneDetailReq.setBizAppCode(reqDto.getBizAppCode());//sourceId:332328_1
        }

        /*1-1-07查询业务应用详情[32]   */
        Assert.isNull(queryBizAppSceneDetailReq.getBizAppCode(), "D1-1查询业务场景菜单列表-1-1-07查询业务应用详情-业务应用标识不能为空", false);
        bizAppScene = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq);


//步骤1: 1-1-09查询业务场景列表 - queryBizSceneList
        List<BizScene> listBizScene = new ArrayList<>();
        if (bizAppScene != null) {
            QueryBizSceneListReq queryBizSceneListReq = new QueryBizSceneListReq();
            if (bizAppScene != null) {
                queryBizSceneListReq.setBizAppId(bizAppScene.getBizAppId());//sourceId:332340_1
            }
            if (reqDto != null) {
                queryBizSceneListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:333425_1
            }

            /*1-1-09查询业务场景列表[1416]   */
            Assert.isNull(queryBizSceneListReq.getBizAppId(), "D1-1查询业务场景菜单列表-1-1-09查询业务场景列表-业务应用ID不能为空", false);
            Assert.isNull(queryBizSceneListReq.getSubjectLifeCycle(), "D1-1查询业务场景菜单列表-1-1-09查询业务场景列表-主体生命周期不能为空", false);
            listBizScene = mBizSceneService.queryBizSceneList(queryBizSceneListReq);


            listBizScene_1 = listBizScene;
        }

        QueryBizSceneMenuListRespDto retData = new QueryBizSceneMenuListRespDto();
        retData.setBizSceneList(listBizScene_1.stream().map(item -> BeanUtil.toBean(item, BizSceneDto.class)).collect(Collectors.toList()));//sourceId:332345_1


        return retData;
    }

    /**
     * D1-1查询赋能的应用列表[4977]
     * gen by moon at 10/22/2022, 4:26:25 PM
     */
    @Trace(operationName = "D1-1查询赋能的应用列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryEnablingAppListRespDto queryEnablingAppList(QueryEnablingAppListReqDto reqDto) {


        List<BizAppScene> listBizAppScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq = new QueryBizAppSceneDetailReq();
        if (reqDto != null) {
            queryBizAppSceneDetailReq.setBizAppCode(reqDto.getBizAppCode());//SimpleFieldAssign//sourceId:385213_1
        }

        /*1-1-07查询业务应用ID[32]   */
        Assert.isNull(queryBizAppSceneDetailReq.getBizAppCode(), "D1-1查询赋能的应用列表-1-1-07查询业务应用ID-业务应用标识不能为空", false);
        bizAppScene = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq);
        Assert.isTrue(bizAppScene == null || bizAppScene.getBizAppId() == null, "返回值不能为空", false);


//步骤1: 1-1-08查询应用赋能场景列表 - queryBizAppSceneRelList
        List<BizAppSceneRelationship> listBizAppSceneRelationship = new ArrayList<>();
        if (bizAppScene != null) {
            QueryBizAppSceneRelListReq queryBizAppSceneRelListReq = new QueryBizAppSceneRelListReq();
            queryBizAppSceneRelListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:385208_1
            if (bizAppScene != null) {
                queryBizAppSceneRelListReq.setBizAppId(bizAppScene.getBizAppId());//SimpleFieldAssign//sourceId:385207_1
            }

            /*1-1-08查询当前应用赋能的应用列表[1418]   */
            Assert.isNull(queryBizAppSceneRelListReq.getBizAppId(), "D1-1查询赋能的应用列表-1-1-08查询当前应用赋能的应用列表-赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getSubjectLifeCycle(), "D1-1查询赋能的应用列表-1-1-08查询当前应用赋能的应用列表-主体生命周期不能为空", false);
            listBizAppSceneRelationship = mBizAppSceneRelationshipService.queryBizAppSceneRelList(queryBizAppSceneRelListReq);


        }

//步骤2: 1-1-07批量查询业务应用列表 - batchQueryBizAppScene
        List<BizAppScene> listBizAppScene = new ArrayList<>();
        if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
            BatchQueryBizAppSceneReq batchQueryBizAppSceneReq = new BatchQueryBizAppSceneReq();
            batchQueryBizAppSceneReq.setBizAppSceneList(listBizAppSceneRelationship.stream().map(item -> item.getByBizAppId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:385224_1

            /*1-1-07批量查询业务应用列表[1216]   */

            listBizAppScene = mBizAppSceneService.batchQueryBizAppScene(batchQueryBizAppSceneReq);


            listBizAppScene_1 = listBizAppScene;
        }

        QueryEnablingAppListRespDto retData = new QueryEnablingAppListRespDto();
        retData.setBizAppSceneList(listBizAppScene_1.stream().map(item -> BeanUtil.toBean(item, BizAppSceneDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:386416_1


        return retData;
    }

    /**
     * D1-1查询赋能的应用业务场景列表[4979]
     * gen by moon at 10/22/2022, 4:26:26 PM
     */
    @Trace(operationName = "D1-1查询赋能的应用业务场景列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryEnablingAppSceneListRespDto queryEnablingAppSceneList(QueryEnablingAppSceneListReqDto reqDto) {


        List<BizAppSceneRelationship> listBizAppSceneRelationship_1 = new ArrayList<>();
        List<BizScene> listBizScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq = new QueryBizAppSceneDetailReq();
        if (reqDto != null) {
            queryBizAppSceneDetailReq.setBizAppCode(reqDto.getBizAppCode());//SimpleFieldAssign//sourceId:386419_1
        }

        /*1-1-07查询业务应用详情[32]   */
        Assert.isNull(queryBizAppSceneDetailReq.getBizAppCode(), "D1-1查询赋能的应用业务场景列表-1-1-07查询业务应用详情-业务应用标识不能为空", false);
        bizAppScene = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq);
        Assert.isTrue(bizAppScene == null || bizAppScene.getBizAppId() == null, "返回值不能为空", false);


//步骤1: 1-1-08查询应用赋能场景列表 - queryBizAppSceneRelList
        List<BizAppSceneRelationship> listBizAppSceneRelationship = new ArrayList<>();
        if (bizAppScene != null) {
            QueryBizAppSceneRelListReq queryBizAppSceneRelListReq = new QueryBizAppSceneRelListReq();
            queryBizAppSceneRelListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:385234_1
            if (reqDto != null) {
                queryBizAppSceneRelListReq.setByBizAppId(reqDto.getByBizAppId());//SimpleFieldAssign//sourceId:385239_1
            }
            if (bizAppScene != null) {
                queryBizAppSceneRelListReq.setBizAppId(bizAppScene.getBizAppId());//SimpleFieldAssign//sourceId:385233_1
            }

            /*1-1-08查询应用赋能场景列表[1418]   */
            Assert.isNull(queryBizAppSceneRelListReq.getByBizAppId(), "D1-1查询赋能的应用业务场景列表-1-1-08查询应用赋能场景列表-被赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getBizAppId(), "D1-1查询赋能的应用业务场景列表-1-1-08查询应用赋能场景列表-赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getSubjectLifeCycle(), "D1-1查询赋能的应用业务场景列表-1-1-08查询应用赋能场景列表-主体生命周期不能为空", false);
            listBizAppSceneRelationship = mBizAppSceneRelationshipService.queryBizAppSceneRelList(queryBizAppSceneRelListReq);


            listBizAppSceneRelationship_1 = listBizAppSceneRelationship;
        }

//步骤2: 1-1-09批量查询业务场景列表 - batchQueryBizScene
        List<BizScene> listBizScene = new ArrayList<>();
        if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
            BatchQueryBizSceneReq batchQueryBizSceneReq = new BatchQueryBizSceneReq();
            batchQueryBizSceneReq.setBizSceneList(listBizAppSceneRelationship.stream().map(item -> item.getBizSceneId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:385241_1
            batchQueryBizSceneReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:385242_1

            /*1-1-09批量查询业务场景列表[225]   */
            Assert.isNull(batchQueryBizSceneReq.getSubjectLifeCycle(), "D1-1查询赋能的应用业务场景列表-1-1-09批量查询业务场景列表-主体生命周期不能为空", false);
            listBizScene = mBizSceneService.batchQueryBizScene(batchQueryBizSceneReq);


            listBizScene_1 = listBizScene;
        }

        QueryEnablingAppSceneListRespDto retData = new QueryEnablingAppSceneListRespDto();
        //数据集融合  MoreListToOneSource
        if (listBizAppSceneRelationship_1 != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1) && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1)) {
            for (BizAppSceneRelationship bizAppSceneRelationship : listBizAppSceneRelationship_1) {
                BizAppSceneRelDto retElm = new BizAppSceneRelDto();
                retElm.setBizAppSceneRelationshipId(bizAppSceneRelationship.getBizAppSceneRelationshipId());//SimpleFieldAssign//sourceId:109696_2
                retElm.setBizSceneId(bizAppSceneRelationship.getBizSceneId());//SimpleFieldAssign//sourceId:109697_2
                retData.getBizAppSceneRelList().add(retElm);
                if (listBizScene_1 != null && !CollectionUtil.isEmpty(listBizScene_1)) {
                    for (BizScene bizScene : listBizScene_1) {
                        if (bizScene.getBizSceneId().equals(bizAppSceneRelationship.getBizSceneId())) {
                            retElm.setBizSceneCode(bizScene.getBizSceneCode());//SimpleFieldAssign//sourceId:109698_2
                            retElm.setBizSceneName(bizScene.getBizSceneName());//SimpleFieldAssign//sourceId:109699_2
                            retElm.setBizAppId(bizScene.getBizAppId());//SimpleFieldAssign//sourceId:109700_2
                        }
                    }
                }

            }
        }//sourceId:385250_1


        return retData;
    }

    /**
     * D3查询当前被赋能业务场景列表[5001]
     * gen by moon at 10/25/2022, 9:38:51 AM
     */
    @Trace(operationName = "D3查询当前被赋能业务场景列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryCurrentBizAppSceneRelEdListRespDto queryCurrentBizAppSceneRelEdList(QueryCurrentBizAppSceneRelEdListReqDto reqDto) {


        List<BizAppSceneRelationship> listBizAppSceneRelationship_1 = new ArrayList<>();
        List<BizScene> listBizScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq = new QueryBizAppSceneDetailReq();
        queryBizAppSceneDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:388626_1
        if (reqDto != null) {
            queryBizAppSceneDetailReq.setBizAppCode(reqDto.getByBizAppCode());//SimpleFieldAssign//sourceId:388614_1
        }

        /*1-1-07查询被赋能业务应用ID[32]   */
        Assert.isNull(queryBizAppSceneDetailReq.getBizAppCode(), "D3查询当前被赋能业务场景列表-1-1-07查询被赋能业务应用ID-业务应用标识不能为空", false);
        Assert.isNull(queryBizAppSceneDetailReq.getSubjectLifeCycle(), "D3查询当前被赋能业务场景列表-1-1-07查询被赋能业务应用ID-主体生命周期不能为空", false);
        bizAppScene = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq);


//步骤1: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene_2 = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq_1 = new QueryBizAppSceneDetailReq();
        queryBizAppSceneDetailReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:388625_1
        if (reqDto != null) {
            queryBizAppSceneDetailReq_1.setBizAppCode(reqDto.getBizAppCode() != null ? String.valueOf(reqDto.getBizAppCode()) : "");//SimpleFieldAssign//sourceId:388604_1
        }

        /*1-1-07查询赋能的业务应用ID[32]   */
        Assert.isNull(queryBizAppSceneDetailReq_1.getBizAppCode(), "D3查询当前被赋能业务场景列表-1-1-07查询赋能的业务应用ID-业务应用标识不能为空", false);
        Assert.isNull(queryBizAppSceneDetailReq_1.getSubjectLifeCycle(), "D3查询当前被赋能业务场景列表-1-1-07查询赋能的业务应用ID-主体生命周期不能为空", false);
        bizAppScene_2 = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq_1);


//步骤2: 1-1-08查询应用赋能场景列表 - queryBizAppSceneRelList
        List<BizAppSceneRelationship> listBizAppSceneRelationship = new ArrayList<>();
        if (bizAppScene != null) {
            QueryBizAppSceneRelListReq queryBizAppSceneRelListReq = new QueryBizAppSceneRelListReq();
            queryBizAppSceneRelListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:388597_1
            if (bizAppScene != null) {
                queryBizAppSceneRelListReq.setByBizAppId(bizAppScene.getBizAppId());//SimpleFieldAssign//sourceId:388596_1
            }
            if (bizAppScene_2 != null) {
                queryBizAppSceneRelListReq.setBizAppId(bizAppScene_2.getBizAppId());//SimpleFieldAssign//sourceId:388598_1
            }

            /*1-1-08查询应用赋能场景列表[1418]   */
            Assert.isNull(queryBizAppSceneRelListReq.getByBizAppId(), "D3查询当前被赋能业务场景列表-1-1-08查询应用赋能场景列表-被赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getBizAppId(), "D3查询当前被赋能业务场景列表-1-1-08查询应用赋能场景列表-赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getSubjectLifeCycle(), "D3查询当前被赋能业务场景列表-1-1-08查询应用赋能场景列表-主体生命周期不能为空", false);
            listBizAppSceneRelationship = mBizAppSceneRelationshipService.queryBizAppSceneRelList(queryBizAppSceneRelListReq);


            listBizAppSceneRelationship_1 = listBizAppSceneRelationship;
        }

//步骤3: 1-1-09批量查询业务场景列表 - batchQueryBizScene
        List<BizScene> listBizScene = new ArrayList<>();
        if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
            BatchQueryBizSceneReq batchQueryBizSceneReq = new BatchQueryBizSceneReq();
            batchQueryBizSceneReq.setBizSceneList(listBizAppSceneRelationship.stream().map(item -> item.getBizSceneId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:388600_1
            batchQueryBizSceneReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:388601_1

            /*1-1-09批量查询业务场景列表[225]   */
            Assert.isNull(batchQueryBizSceneReq.getSubjectLifeCycle(), "D3查询当前被赋能业务场景列表-1-1-09批量查询业务场景列表-主体生命周期不能为空", false);
            listBizScene = mBizSceneService.batchQueryBizScene(batchQueryBizSceneReq);


            listBizScene_1 = listBizScene;
        }

        QueryCurrentBizAppSceneRelEdListRespDto retData = new QueryCurrentBizAppSceneRelEdListRespDto();
        //数据集融合  MoreListToOneSource
        if (listBizAppSceneRelationship_1 != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1) && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1)) {
            for (BizAppSceneRelationship bizAppSceneRelationship : listBizAppSceneRelationship_1) {
                BizAppSceneRelDto retElm = new BizAppSceneRelDto();
                retElm.setBizAppSceneRelationshipId(bizAppSceneRelationship.getBizAppSceneRelationshipId());//SimpleFieldAssign//sourceId:110359_2
                retElm.setBizSceneId(bizAppSceneRelationship.getBizSceneId());//SimpleFieldAssign//sourceId:110360_2
                retData.getBizAppSceneRelList().add(retElm);
                if (listBizScene_1 != null && !CollectionUtil.isEmpty(listBizScene_1)) {
                    for (BizScene bizScene : listBizScene_1) {
                        if (bizScene.getBizSceneId().equals(bizAppSceneRelationship.getBizSceneId())) {
                            retElm.setBizSceneCode(bizScene.getBizSceneCode());//SimpleFieldAssign//sourceId:110361_2
                            retElm.setBizSceneName(bizScene.getBizSceneName());//SimpleFieldAssign//sourceId:110362_2
                        }
                    }
                }

            }
        }//sourceId:388630_1


        return retData;
    }

    /**
     * D1-1查询赋能的应用业务场景列表(公共)[4979]
     * gen by moon at 10/28/2022, 8:45:30 PM
     */
    @Trace(operationName = "D1-1查询赋能的应用业务场景列表(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryEnablingAppSceneListComRespDto queryEnablingAppSceneListCom(QueryEnablingAppSceneListComReqDto reqDto) {


        List<BizAppSceneRelationship> listBizAppSceneRelationship_1 = new ArrayList<>();
        List<BizScene> listBizScene_1 = new ArrayList<>();
//步骤0: 1-1-07查询业务应用详情 - queryBizAppSceneDetail
        BizAppScene bizAppScene = null;
        QueryBizAppSceneDetailReq queryBizAppSceneDetailReq = new QueryBizAppSceneDetailReq();
        if (reqDto != null) {
            queryBizAppSceneDetailReq.setBizAppCode(reqDto.getBizAppCode());//SimpleFieldAssign//sourceId:386419_1
        }

        /*1-1-07查询业务应用详情[32]   */
        Assert.isNull(queryBizAppSceneDetailReq.getBizAppCode(), "D1-1查询赋能的应用业务场景列表(公共)-1-1-07查询业务应用详情-业务应用标识不能为空", false);
        bizAppScene = mBizAppSceneService.queryBizAppSceneDetail(queryBizAppSceneDetailReq);
        Assert.isTrue(bizAppScene == null || bizAppScene.getBizAppId() == null, "返回值不能为空", false);


//步骤1: 1-1-08查询应用赋能场景列表 - queryBizAppSceneRelList
        List<BizAppSceneRelationship> listBizAppSceneRelationship = new ArrayList<>();
        if (bizAppScene != null) {
            QueryBizAppSceneRelListReq queryBizAppSceneRelListReq = new QueryBizAppSceneRelListReq();
            queryBizAppSceneRelListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:385234_1
            if (reqDto != null) {
                queryBizAppSceneRelListReq.setByBizAppId(reqDto.getByBizAppId());//SimpleFieldAssign//sourceId:385239_1
            }
            if (bizAppScene != null) {
                queryBizAppSceneRelListReq.setBizAppId(bizAppScene.getBizAppId());//SimpleFieldAssign//sourceId:385233_1
            }

            /*1-1-08查询应用赋能场景列表[1418]   */
            Assert.isNull(queryBizAppSceneRelListReq.getByBizAppId(), "D1-1查询赋能的应用业务场景列表(公共)-1-1-08查询应用赋能场景列表-被赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getBizAppId(), "D1-1查询赋能的应用业务场景列表(公共)-1-1-08查询应用赋能场景列表-赋能业务应用ID不能为空", false);
            Assert.isNull(queryBizAppSceneRelListReq.getSubjectLifeCycle(), "D1-1查询赋能的应用业务场景列表(公共)-1-1-08查询应用赋能场景列表-主体生命周期不能为空", false);
            listBizAppSceneRelationship = mBizAppSceneRelationshipService.queryBizAppSceneRelList(queryBizAppSceneRelListReq);


            listBizAppSceneRelationship_1 = listBizAppSceneRelationship;
        }

//步骤2: 1-1-09批量查询业务场景列表 - batchQueryBizScene
        List<BizScene> listBizScene = new ArrayList<>();
        if (listBizAppSceneRelationship != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship) && listBizAppSceneRelationship.size() > 0) {
            BatchQueryBizSceneReq batchQueryBizSceneReq = new BatchQueryBizSceneReq();
            batchQueryBizSceneReq.setBizSceneList(listBizAppSceneRelationship.stream().map(item -> item.getBizSceneId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:385241_1
            batchQueryBizSceneReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:385242_1

            /*1-1-09批量查询业务场景列表[225]   */
            Assert.isNull(batchQueryBizSceneReq.getSubjectLifeCycle(), "D1-1查询赋能的应用业务场景列表(公共)-1-1-09批量查询业务场景列表-主体生命周期不能为空", false);
            listBizScene = mBizSceneService.batchQueryBizScene(batchQueryBizSceneReq);


            listBizScene_1 = listBizScene;
        }

        QueryEnablingAppSceneListComRespDto retData = new QueryEnablingAppSceneListComRespDto();
        //数据集融合  MoreListToOneSource
        if (listBizAppSceneRelationship_1 != null && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1) && !CollectionUtil.isEmpty(listBizAppSceneRelationship_1)) {
            for (BizAppSceneRelationship bizAppSceneRelationship : listBizAppSceneRelationship_1) {
                BizAppSceneRelDto retElm = new BizAppSceneRelDto();
                retElm.setBizAppSceneRelationshipId(bizAppSceneRelationship.getBizAppSceneRelationshipId());//SimpleFieldAssign//sourceId:109696_2
                retElm.setBizSceneId(bizAppSceneRelationship.getBizSceneId());//SimpleFieldAssign//sourceId:109697_2
                retData.getBizAppSceneRelList().add(retElm);
                if (listBizScene_1 != null && !CollectionUtil.isEmpty(listBizScene_1)) {
                    for (BizScene bizScene : listBizScene_1) {
                        if (bizScene.getBizSceneId().equals(bizAppSceneRelationship.getBizSceneId())) {
                            retElm.setBizSceneCode(bizScene.getBizSceneCode());//SimpleFieldAssign//sourceId:109698_2
                            retElm.setBizSceneName(bizScene.getBizSceneName());//SimpleFieldAssign//sourceId:109699_2
                            retElm.setBizAppId(bizScene.getBizAppId());//SimpleFieldAssign//sourceId:109700_2
                        }
                    }
                }

            }
        }//sourceId:385250_1


        return retData;
    }
    //
    // retData.setBizSceneList(collectionRemoveExistingDataRes.bizSceneList());
}
